//运行于node需要基于commonJs规范
const resolve = function(path){
    return require('path').resolve(__dirname,path)
}
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    mode:"development",//开发环境，默认的
    entry:'./src/A.js',
    output:{
        //打包之后输出的文件名字以及文件夹的名字
        filename:'aaa[hash:4].js',//哈希文件名为了清除缓存
        path:resolve('dist')//只当生成文件的目录及名字
    },
    plugins:[
        new CleanWebpackPlugin(),//清除哈希旧文件
        new HtmlWebpackPlugin({
            template:'./index.html',
            title:'Axxxx',
            filename:'test.html',//指定生成html名
            minify:true
        })
    ]
}